public class Demo05 {

    public static void main(String[] args) {

        //创建char类型的二位数组用于保存字符
        char[][] arr = new char[16][16];


        //利用双重for循环给二维数组赋值
        for (int i = 0; i < 16; i++) {
            for (int j = 0; j < 16; j++) {
                //给第一行赋值
                if (i == 0) {
                    if (j == 0) {
                        arr[0][0] = ' ';
                    } else if (j <= 9) {
                        arr[i][j] = (char) ('0' + j);//依次赋值1-9
                    } else {
                        arr[i][j] = (char) ('W' + j);//依次赋值a-f
                    }
                }

                //给第一列赋值
                if (j == 0) {
                    if (i == 0) {
                        arr[0][0] = ' ';
                    } else if (i <= 9) {
                        arr[i][j] = (char) ('0' + i);//依次赋值1-9
                    } else {
                        arr[i][j] = (char) ('W' + i);//依次赋值a-f
                    }
                }

                //给其他行列赋值
                if (i > 0 && j > 0) {
                    arr[i][j] = '+';
                }

            }


        }

        //打印数组
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print("  " + arr[i][j]);
            }
            System.out.println();
        }
    }

}


